import Vue from 'vue'
import App from './App.vue'

import VueRouter from 'vue-router'

Vue.use(VueRouter);

//1.创建组件
import home from "./components/home.vue" //引入home组件
import news from "./components/news.vue" //引入news组件

//2.配置路由
const routes = [
  { path: '/home', component: home },
  { path: '/news', component: news }
];

//3.实例话vue-router
const router = new VueRouter({
  routes // (缩写) 相当于 routes: routes
});

//4.挂载路由
new Vue({
  el: '#app',
  router,
  render: h => h(App)
});
